<template>
    <div id="app">
        <Global_Guide />
        <router-view />
    </div>
</template>

<script>
import Global_Guide from "@guide/vue";
import $ from "jquery";

export default {
    components: {
        Global_Guide
    },
    mounted() {
        this.init();
        this.setListener();
        this.alterMenu();
    },
    methods: {
        init() {
            this.$jspt.readStore();
        },
        setListener() {
            // 添加监听器，在刷新之前将 vuex 的信息保存至 Session Storage
            this.$store.state.view.token.start = false;
            window.addEventListener("beforeunload", () => {
                sessionStorage.setItem("store",JSON.stringify(this.$store.state))
            });
        },
        alterMenu() {
            this.$jspt.addMenu(this.$store.state.user);
        }
    }
}
</script>

<style lang="scss">
@import "@scss/app.scss";
</style>
